<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">


<head th:replace="fragments/common_header :: common-header(~{},~{})"></head>
<body>
<div id="wrapper">
    <!-- 左侧菜单栏-->
    <div th:replace="fragments/common_leftmenu :: left-menu"></div>
    <!-- 左侧菜单栏结束-->
    <div id="page-wrapper" class="gray-bg">
        <!-- 上部导航条 -->
        <div th:replace="fragments/common_top :: top-bar"></div>
        <!-- 上部导航条结束 -->
        <!--内容-->
        <div class="wrapper wrapper-content animated fadeInRight">
            <div class="ibox ">
                <!--列表-->
                <div class="ibox-title">
                    <h3>门店列表</h3>
                    <button class="btn btn-sm btn-primary"
                            th:onclick="@{'location.href=\'' + ${#httpServletRequest.getContextPath()}+'/shop/toAdd\''}">
                        新增门店
                    </button>

                </div>
                <div class="ibox-content">
                    <div class="table-responsive">
                        <table class="table table-bordered table-hover dataTables-example">
                            <thead>
                            <tr th:align="center">
                                <td>门店编号</td>
                                <td>所在城市</td>
                                <td>所属地区</td>
                                <td>名称</td>
                                <td>地址</td>
                                <td>电话</td>
                                <td>营业时间</td>
                                <td>操作</td>
                            </tr>
                            </thead>
                            <tbody>
                            <tr th:each="shop:${shops}">
                                <td th:text="${shop.getShop_number()}"></td>
                                <td th:text="${shop.getShop_city()}"></td>
                                <td th:text="${shop.getShop_area()}"></td>
                                <td th:text="${shop.getShop_name()}"></td>
                                <td th:text="${shop.getShop_address()}"></td>
                                <td th:text="${shop.getShop_phone()}"></td>
                                <td th:text="${shop.getShop_hours()}"></td>


                                <td>
                                    <button class="btn btn-sm btn-primary"
                                            th:onclick="@{'location.href=\'' + ${#httpServletRequest.getContextPath()}+'/shop/toEdit/'+${shop.getShop_number()}+'\''}">
                                        编辑
                                    </button>
                                    <button class="btn btn-sm btn-danger"
                                            th:onclick="@{'location.href=\'' + ${#httpServletRequest.getContextPath()}+'/shop/delete/'+${shop.getShop_number()}+'\''}">
                                        删除
                                    </button>
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<!--内容结束-->
<!-- 底部栏 -->
<!--<div th:replace="fragments/common_footer :: foot-bar"></div>-->
<!-- 底部栏结束 -->
<div th:replace="fragments/common_script :: scripts"></div>
</body>
<!-- Page-Level Scripts -->
<script>
    $(document).ready(function () {
        $('.dataTables-example').DataTable({
            pageLength: 10,
            responsive: true,
            dom: '<"html5buttons"B>lTfgitp',
            buttons: [
                {extend: 'copy'},
                {extend: 'csv'},
                {extend: 'excel', title: '门店列表'},
                {extend: 'pdf', title: '门店列表'},
                {
                    extend: 'print',
                    customize: function (win) {
                        $(win.document.body).addClass('white-bg');
                        $(win.document.body).css('font-size', '10px');
                        $(win.document.body).find('table')
                            .addClass('compact')
                            .css('font-size', 'inherit');
                    }
                }
            ]
        });
    });


</script>


</html>